<include file="public/layout" />
<script type="text/javascript" src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>

<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <div class="subject">
        <h3>分成记录列表</h3>
        <h5>分销关系管理</h5>
      </div>
    </div>
  </div>
  <!-- 操作说明 -->
  <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
    <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
      <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
      <span title="收起提示" id="explanationZoom" style="display: block;"></span>
    </div>
     <ul>
      <li style="color:red">
      	如果应该结算的用户分成订单没结算, 请检查以下设置
      		<br>1. 系统分成时间未到,请检查分销订单结算时间:系统->设置->分销设置->分成时间
      		<br/>2.用户已经确认收货的订单才会计算分成, 分成的订单会标识已"分成"
      </li>
      <li>根据用户ID、订单编号和时间查询</li>
    </ul>
  </div>
  <div class="flexigrid">
    <div class="mDiv">
      <div class="ftitle">
        <h3>分成记录列表</h3>
        <h5>(共{$pager->totalRows}条记录)</h5>
      </div>
      <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
	  <form class="navbar-form form-inline"  method="post" action="{:U('Admin/Distribut/rebate_log')}"  name="search-form2" id="search-form2" onsubmit="return search_form(this)">
          <input type="hidden" class="btn" name="p" value="1">
          <input type="hidden" class="btn" name="sort" value="asc">
      <div class="sDiv">
		<div class="sDiv2">	 
			<input type="text" size="30" id="user_id" placeholder="获佣用户id"  value="{$user_id}" name="user_id" class="qsbox">
		</div>
		<div class="sDiv2">	 
			<input type="text" size="30" id="order_sn" placeholder="订单编号" value="{$order_sn}" name="order_sn" class="qsbox" >
		</div>
		<div class="sDiv2">	 
			<input type="text" size="30" id="start_time" placeholder="生成日志开始时间" value="{$start_time}" name="start_time" class="qsbox" >
		</div>
		<div class="sDiv2">	 
			<input type="text" size="30" id="end_time" placeholder="生成日志结束时间" value="{$end_time}" name="end_time" class="qsbox">
		</div>
		<div class="sDiv2">	 
			<select class="select" id="status" name="status">                       
                    <option value="">全部</option>                    
                    <option value="0"<if condition="$_REQUEST['status'] heq '0'">selected</if>>未付款</option>
                    <option value="1"<if condition="$_REQUEST['status'] eq 1">selected</if>>已付款</option>
                    <option value="2"<if condition="$_REQUEST['status'] eq 2">selected</if>>等待分成</option>
                    <option value="3"<if condition="$_REQUEST['status'] eq 3">selected</if>>已分成</option>
                    <option value="4"<if condition="$_REQUEST['status'] eq 4">selected</if>>已取消</option>
                  </select>
		</div>
        <div class="sDiv2">
          <input type="submit" class="btn" value="搜索">
        </div>
      </div>
     </form>
    </div>
    <div class="hDiv">
      <div class="hDivBox" id="ajax_return">
        <table cellspacing="0" cellpadding="0">
          <thead>
	        	<tr>
	              <th class="sign" axis="col0">
	                <div style="width: 24px;"><i class="ico-check"></i></div>
	              </th>
	              <th align="left" abbr="order_sn" axis="col3" class="">
	                <div style="text-align: left; width: 120px;" class="">ID</div>
	              </th>
	              <th align="left" abbr="consignee" axis="col4" class="">
	                <div style="text-align: left; width: 120px;" class="">下单会员</div>
	              </th>
	              <th align="left" abbr="consignee" axis="col4" class="">
	                <div style="text-align: left; width: 120px;" class="">获佣用户</div>
	              </th>
	              <th align="center" abbr="article_show" axis="col5" class="">
	                <div style="text-align: center; width: 160px;" class="">订单编号</div>
	              </th>
	              <th align="center" abbr="article_time" axis="col6" class="">
	                <div style="text-align: center; width: 120px;" class="">获佣金额</div>
	              </th>
	              <th align="center" abbr="article_time" axis="col6" class="">
	                <div style="text-align: center; width: 120px;" class="">订单金额</div>
	              </th>
	              <th align="center" abbr="article_time" axis="col6" class="">
	                <div style="text-align: center; width: 120px;" class="">获佣用户级别</div>
	              </th>
	              <th align="center" abbr="article_time" axis="col6" class="">
	                <div style="text-align: center; width: 160px;" class="">记录生成时间</div>
	              </th>
	              <th align="center" abbr="article_time" axis="col6" class="">
	                <div style="text-align: center; width: 90px;" class="">状态</div>
	              </th>
	              <th style="width:100%" axis="col7">
	                <div></div>
	              </th>
	            </tr>
	          </thead>
        </table>
      </div>
    </div>
    <div class="bDiv" style="height: auto;">
      <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
        	<table cellspacing="0" cellpadding="0">
	          <tbody>
	          <if condition="empty($list) eq true">
		 		<tr data-id="0">
			        <td class="no-data" align="center" axis="col0" colspan="50">
			        	<i class="fa fa-exclamation-circle"></i>没有符合条件的记录
			        </td>
			     </tr>
			<else/>
	          <volist name="list" id="v">
		        	<tr>
		              <td class="sign" axis="col0">
		                <div style="width: 24px;"><i class="ico-check"></i></div>
		              </td>
		              <td align="left" abbr="order_sn" axis="col3" class="">
		                <div style="text-align: left; width: 120px;" class="">{$v.id}</div>
		              </td>
		              <td align="left" abbr="consignee" axis="col4" class="">
		                <div style="text-align: left; width: 120px;" class="">
							<a href="{:U('Admin/user/detail',array('id'=>$v[buy_user_id]))}">
					     		<if condition="$v[buy_user][nickname] neq ''">
                                      {$v[buy_user][nickname]}
                                  <elseif condition="$v[buy_user][email] neq ''"/>
                                       {$v[buy_user][email]}
                                  <else />{$v[buy_user_id][mobile]}</if>
							</a>
						</div>
		              </td>
		              <td align="left" abbr="consignee" axis="col4" class="">
		                <div style="text-align: left; width: 120px;" class="">
							<a href="{:U('Admin/user/detail',array('id'=>$v[user_id]))}">
					     		<if condition="$v[get_user][nickname] neq ''">
                                      {$v[get_user][nickname]}
                                  <elseif condition="$v[get_user][email] neq ''"/>
                                       {$v[get_user][email]}
                                  <else />{$v[get_user][mobile]}</if>
							</a>
						</div>
		              </td>
		              <td align="center" abbr="article_show" axis="col5" class="">
		                 <div style="text-align: center; width: 160px;" class="">
		                	<a href="{:U('Admin/order/detail',array('order_id'=>$v[order_id]))}">
                           		{$v.order_sn}
                             </a>
                          </div>
		              </td>
		              <td align="center" abbr="article_time" axis="col6" class="">
		                <div style="text-align: center; width: 120px;" class="">{$v.money}</div>
		              </td>
		              <td align="center" abbr="article_time" axis="col6" class="">
		                <div style="text-align: center; width: 120px;" class="">{$v.goods_price}</div>
		              </td>
		              <td align="center" abbr="article_time" axis="col6" class="">
		                <div style="text-align: center; width: 120px;" class="">
			                <if condition="$v[level] eq 1"> 一级分销商
							<elseif condition="$v[level] eq 2"/>二级分销商
							<else /> 三级分销商
							</if>
		                </div>
		              </td>
		              <td align="center" abbr="article_time" axis="col6" class="">
		                <div style="text-align: center; width: 160px;" class="">{$v['create_time']}</div>
		              </td>
		              <td align="center" abbr="article_time" axis="col6" class="">
		                <div style="text-align: center; width: 90px;" class="">
		                	<if condition="$v[status] eq 0">未付款(未分成)</if>
                            <if condition="$v[status] eq 1">已付款(未分成)</if>
                            <if condition="$v[status] eq 2">等待分成</if>
                            <if condition="$v[status] eq 3">已分成</if>
                            <if condition="$v[status] eq 4">已取消</if>  
						</div>
		              </td>
		              <td style="width:100%" axis="col7">
		                <div></div>
		              </td>
		            </tr>
		            </volist>
		            </if>
		          </tbody>
	        </table>
      </div>
      <div class="iDiv" style="display: none;"></div>
    </div>
    <!--分页位置--> 
    <div class="row">
	    <div class="col-sm-6 text-left"></div>
	    <div class="col-sm-6 text-right">{$pager->show()}</div>
	</div>
   	</div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
		// 点击刷新数据
		$('.fa-refresh').click(function(){
			location.href = location.href;
		});
        $('#start_time').layDate();
        $('#end_time').layDate();

		$('.ico-check ' , '.hDivBox').click(function(){
			$('tr' ,'.hDivBox').toggleClass('trSelected' , function(index,currentclass){
	    		var hasClass = $(this).hasClass('trSelected');
	    		$('tr' , '#flexigrid').each(function(){
	    			if(hasClass){
	    				$(this).addClass('trSelected');
	    			}else{
	    				$(this).removeClass('trSelected');
	    			}
	    		});  
	    	});
		});
	});

    function search_form(obj) {
        var start_time = $('#start_time').val();
        var end_time = $('#end_time').val();
        if(start_time == '' || end_time == ''){
            layer.alert('帅选时间不能空', {icon: 2});
            return false;
        }
//        $(obj).submit();
    }
</script>
</body>
</html>